var custom_waittime = []
// 封装顾客组件(其中包含了头像+等待条 => 是一体)，并返回一个顾客对象
function Custom() {
    if(alluser.length >= 6) return ; // 最多6个顾客
    var obj = {
        name:'',
        food:[],
        wait_time:100, // 耐心值
        touxiang:'',
        money:[]
    }
    var custom = ['url(./restaurant/379339-512.png)', 'url(./restaurant/379444-512.png)', 'url(./restaurant/379446-512.png)', 'url(./restaurant/379448-512.png)','url(./restaurant/iconfinder_Boss-3_379348.png)','url(./restaurant/iconfinder_Man-16_379485.png)','url(./restaurant/iconfinder_Rasta_379441.png)']
    var r = Addcircle()
    r.className += ' custom_in'
    var rand = Math.floor(Math.random() * 7)
    obj.touxiang = custom[rand]
    r.style.backgroundImage = custom[rand]
    line.appendChild(r)

    // 这是顾客下方等待条__目前客人无座——等待中
    var wait =document.createElement('div')
    wait.className = 'wait'
    wait.innerHTML = '等位中'
    r.appendChild(wait)
    let k = 200
    for(let i = 0 ; i < line.children.length ; i++){
        line.children[i].style.right = `${(line.children.length - i - 1)*10}%` 
        line.children[i].style.position = 'absolute' 
        line.children[i].style.zIndex = `${k--}`
    }
    // r.style.right = '0%'
    // 随机生成顾客信息 => 姓名
    var frist_name = ['Z','Y','Q','T','M','L','R','K','G','P','X','B'],
        last_name = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'],
        s_name = frist_name[Math.floor(Math.random() * 12)]

    for(let i = 0 ; i < new Date().getSeconds()%6 ; i++){
        s_name += last_name[Math.floor(Math.random() * 26)]
    }
    obj.name = s_name
    // 将该顾客存至所有顾客中
    alluser.push(obj)
    // 后续开始计时  ------   顾客耐心值(暂未完善)
    // custom_waittime.push(setTimeout(()=>{
    //     console.log('now')
    //     let cus = document.getElementsByClassName('custom_in')[0]
    //     line.removeChild(cus)
    //     alluser.shift()
    // },70000))
    return obj
}